const app = getApp(), myreg = /^1[34578]\d{9}$/;
Page({
    data: {
        inputPhone: '',
        inputCode: '',
        yzmnone: false,
        countdown: '发送验证码',
    },
    onLoad() { },
    onShow(){
        app.Getinto();
    },
    /*input*/
    codeinput(e) {
        this.setData({
            inputCode: e.detail.value
        })
    },
    passinput(e) {
        this.setData({
            inputPass: e.detail.value
        })
    },
    /*绑定*/
    SignIn() {
        this.SignInAjax();
    },
    SignInAjax() {
        app.request.request({
            link: '/api/supplier/login',
            methodtype: 'POST',
            ting: {
                username: this.data.inputCode,
                password: this.data.inputPass,
            },
            succ: (res) => {
                console.log(res,'55454')
                let Boxs = res.data.data,BoxMeta = res.data.message;
                if (res.data.status == 200) {
                    app.globalData.my = app.Transfer({ name: 'fyzs_info', info: Boxs});
                    app.globalData.brand = app.Transfer({ name: 'fyzs_brand', info: { brand_id: Boxs.brand_id, is_brand: Boxs.is_brand} });
                    app.util.Success('登录成功', () => {
                        app.request.must.merchant_id = Boxs.merchant_id;
                        setTimeout(() => {
                            wx.reLaunch({
                                url: '/pages/index/index'
                            })
                        }, 1000)
                    });
                } else {
                    app.util.showModal(false, '提示', BoxMeta)
                }
            },
            fail: (err) => {
                app.util.showModal(false, '网络错误', '请检查网络，重新登录')
            }
        })
    },
})